Page({

	/**
	 * 页面的初始数据
	 */
	data: {
		djshu: 4,//树的等级1，2，3，4
		tree: false,
		waternum: 0,
		waterbool: false,
		animation: true,
		shutree: false,
		bottle: false
	},
	onLoad: function (options) {

	},
	onShow: function () {

	},
	//返回上一级
	back() {
		wx.navigateBack({
			delta: 1,
		})
	},
	treeend() {
		//树动画结束
		this.setData({
			tree: false,
			shutree: false,
			animation: true,
		})
		var num = this.data.waternum
		if (num == 100) {
			wx.showToast({
				title: '你以完成任务',
			})
			return false
		}
		this.setData({
			waternum: num += 20
		})
		console.log(this.data.waternum)
	},

	bottlestart() {//水滴动画开始前
		this.setData({
			bottle: true
		})
	},
	bottleend() {//水滴动画结束
		this.setData({
			bottle: false,
			tree: false,
			waterbool: true,
		})
		setTimeout(() => {
			this.setData({
				shutree: true,
				waterbool: false,
			})
		}, 500)
	},
	//浇水
	animation() {//动画事件启动
		var animation = this.data.animation
		if (animation) {
			this.setData({
				animation: false,
				tree: true
			})
		} else {
			return false
		}

	},
	answer() {
		wx.navigateTo({
			url: '/index/pages/dati/dati',
		})
	},
	tosign() {
		wx.navigateTo({
			url: '/index/pages/qiandao/qiandao',
		})
	},
	shaomiao() {
		wx.switchTab({
			url: '/pages/zwy/zwy',
		})
	},





})